package com.manshu.manshuweb.common;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class MultiThread {
    @Scheduled(cron = "*/1 * * * * ?")
    @Async("nihao")
    public void zhixing() throws InterruptedException {
        log.info("多线程任务开始执行 start ");
        Thread.sleep(10_000);
        log.info("多线程任务开始执行 end ");
    }

    @Scheduled(cron = "*/1 * * * * ?")
    @Async("nihao")
    public void zhixing2() throws InterruptedException {
        log.info("多线程任务开始执行zhixing2 start ");
        log.info("多线程任务开始执行zhixing2 end ");
    }
}
